﻿<%@ Page Title="" Language="vb" AutoEventWireup="false" MasterPageFile="~/Site.Master" CodeBehind="detail.aspx.vb" Inherits="task3.detail" %>
<%@ Register src="ShareBox.ascx" tagname="ShareBox" tagprefix="uc1" %>
<asp:Content ID="Content1" ContentPlaceHolderID="HeadContent" runat="server">
</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="MainContent" runat="server"> 
    <uc1:ShareBox ID="ShareBox1" runat="server" />
    <asp:ListView ID="ListView1" runat="server" DataKeyNames="ID" 
        DataSourceID="AccessDataSource1"  >
        <EmptyDataTemplate>
            <span>No data was returned.</span>
        </EmptyDataTemplate>        
        <ItemTemplate>
        
            <a class="grabit" href="<%# Eval("Deallink") %>">GRABIT
            </a>
            Dealname:
            <asp:Label ID="DealnameLabel" runat="server" Text='<%# Eval("Dealname") %>' Font-Bold="true" />
            <br />
            Dealprice:
            GBP: <asp:Label ID="DealpriceLabel" runat="server" Text='<%# Eval("Dealprice") %>' />
            <br />
            DealDescription:
            <asp:Label ID="DealDescriptionLabel" runat="server" 
                Text='<%# Eval("DealDescription") %>' />
            <br />
            DealExpiry:
            <asp:Label ID="DealExpiryLabel" runat="server" 
                Text='<%# Convert.ToDateTime(Eval("DealExpiry").ToString()).ToString("dd/MM/yyyy HH:mm:ss") %>' />
            <br />
            DealCreatedDate:
            <asp:Label ID="DealCreatedDateLabel" runat="server" 
                Text='<%# Convert.ToDateTime(Eval("DealCreatedDate").ToString()).ToString("dd/MM/yyyy HH:mm:ss") %>' />
            <br />
            UploadedBy:
            <asp:Label ID="UploadedByLabel" runat="server" 
                Text='<%# Eval("UploadedBy") %>' />
            <br />
            <img style="width:30%" src="<%# Eval("Thumbnail") %>" />
            <br />
<br /></span>
        </ItemTemplate>
        <LayoutTemplate>
        
            <div ID="itemPlaceholderContainer" runat="server" 
                style="font-family: Verdana, Arial, Helvetica, sans-serif;">
                <span runat="server" id="itemPlaceholder" />
            </div>
            <div style="text-align: center;background-color: #5D7B9D;font-family: Verdana, Arial, Helvetica, sans-serif;color: #FFFFFF;">
            </div>
        </LayoutTemplate>
    </asp:ListView>
    
    <p>
    <a href="list.aspx">Go back to All Deals</a>
    </p>
    <p>
        <asp:GridView ID="GridView1" runat="server" AutoGenerateColumns="False" 
            DataSourceID="AccessDataSource2">
            <Columns>
                <asp:BoundField DataField="Author" HeaderText="Author" 
                    SortExpression="Author" />
                <asp:BoundField DataField="Title" HeaderText="Title" SortExpression="Title" />
                <asp:BoundField DataField="Commentbody" HeaderText="Commentbody" 
                    SortExpression="Commentbody" />
            </Columns>
        </asp:GridView>
        <asp:AccessDataSource ID="AccessDataSource2" runat="server" 
            DataFile="~/App_Data/DealsDb.accdb" 
            
            SelectCommand="SELECT [Author], [Title], [Commentbody] FROM [Comments] WHERE (([Deal_fkID] = ?) AND ([table_ID] = ?))">
            <SelectParameters>
                <asp:QueryStringParameter Name="Deal_fkID" QueryStringField="Dealid" 
                    Type="Int32" DefaultValue="1" />
                <asp:Parameter DefaultValue="1" Name="table_ID" Type="String" />
            </SelectParameters>
        </asp:AccessDataSource>
    </p>
    <h3>Add Comment:</h3>
    <p>
        Title&nbsp;
        <asp:TextBox ID="tb_title" runat="server"></asp:TextBox>
        &nbsp;<asp:RequiredFieldValidator ID="RequiredFieldValidator5" runat="server" 
            ControlToValidate="tb_title" ErrorMessage="*"></asp:RequiredFieldValidator>
    </p>
    <p>
        <asp:TextBox ID="tb_cb" runat="server" Height="122px" TextMode="MultiLine" 
            Width="752px"></asp:TextBox>
        &nbsp;<asp:RequiredFieldValidator ID="RequiredFieldValidator1" runat="server" 
            ControlToValidate="tb_cb" ErrorMessage="*"></asp:RequiredFieldValidator>
    </p>
    <p>
        <asp:Button ID="b_Comment" runat="server" Text="AddComment" />
    </p>
    <p>
        &nbsp;</p>
    <p>
        <asp:CheckBoxList ID="cb_tags" runat="server" DataSourceID="AccessDataSource3" 
            DataTextField="Tagname" DataValueField="ID" RepeatDirection="Horizontal">
        </asp:CheckBoxList>
        <asp:AccessDataSource ID="AccessDataSource3" runat="server" 
            DataFile="~/App_Data/DealsDb.accdb" 
            SelectCommand="SELECT [ID], [Tagname] FROM [Tags]"></asp:AccessDataSource>
    </p>
    <p>
        <asp:Button ID="btn_Adddealstodb" runat="server" Text="Tagdeal" />
    </p>
    Add new tag 
    <asp:TextBox ID="tb_newtag" runat="server"></asp:TextBox>
    <asp:Button ID="btn_newtag" runat="server" Text="Button" />
    <p>
        &nbsp;</p>
    <p>
        &nbsp;</p>
    <p>
        &nbsp;</p>
    <asp:AccessDataSource ID="AccessDataSource1" runat="server" 
        DataFile="~/App_Data/DealsDb.accdb" 
        SelectCommand="SELECT * FROM [DealDetail] WHERE ([ID] = ?)">
        <SelectParameters>
            <asp:QueryStringParameter DefaultValue="1" Name="ID" QueryStringField="DealId" 
                Type="Int32" />
        </SelectParameters>
    </asp:AccessDataSource>
</asp:Content>
